{% extends 'iframe/basePlus.html.twig' %}
{% block cardHeader %}
    添加<a href="/Admin/Model/index" class="layui-btn layui-btn-sm" style="float:right;margin-top:6px;">列表</a>
{% endblock %}
{% block cardBody %}
    <style>
        .layui-form-label {
            width: 140px;
        }
        .layui-input-block {
            margin-left: 170px;
        }
    </style>
    <form class="layui-form">
        <dry-common role="input" label="名称" name="dry_name" value="" placeholder="请输入名称"></dry-common>
        <dry-common role="select" label="数据库配置键" name="dry_database_config_key" value="" url="/Api/System/getDatabaseConfigKeys"></dry-common>
        <dry-common role="select" label="数据库" name="dry_database" value="" url="/Api/System/getDatabases"></dry-common>
        <dry-common role="input" label="表名称" name="dry_table" value="" placeholder="请输入数据库表的名称"></dry-common>
        <dry-common role="input" label="别名" name="dry_alias" value="" placeholder="请输入别名"></dry-common>
        <dry-common role="input" label="控制器名称" name="dry_controller_name" value="" placeholder="如File"></dry-common>
        <dry-common role="input" label="备注" name="dry_note" value="" placeholder="请输入备注"></dry-common>
        <dry-common role="input" label="排序" name="dry_sort" value="0" placeholder="请输入排序"></dry-common>
        <dry-common role="transfer" label="字段" name="dry_field" value="" url="/Api/Field/getList"></dry-common>
        <dry-common role="select" label="附加字段" name="dry_additional_column" value="" url="/Api/Choice/getListByKey?key=additionalColumn"></dry-common>
        <dry-common role="select" label="分页数" name="dry_page_size" value="" url="/Api/Choice/getListByKey?key=pageSize"></dry-common>
        <dry-common role="input" label="排序sql" name="dry_sort_sql" value="" placeholder="如:id desc,dry_sort asc"></dry-common>
        <dry-common role="select" label="添加编辑时label宽度" name="dry_add_edit_label_width" value="" url="/Api/Choice/getListByKey?key=fieldWidth"></dry-common>
        <dry-common role="select" label="查看时label宽度" name="dry_show_label_width" value="" url="/Api/Choice/getListByKey?key=fieldWidth"></dry-common>
        <dry-common role="select" label="列表时操作按钮宽度" name="dry_index_operate_width" value="" url="/Api/Choice/getListByKey?key=fieldWidth"></dry-common>
        <dry-common role="transfer" label="按钮" name="dry_button" value="" url="/Api/Automate/getListForChoice?alias=button&fieldId=43"></dry-common>
        <dry-common role="checkboxBig" label="配置" name="dry_config" value="" url="/Api/Choice/getListByKey?key=modelConfig"></dry-common>
        <dry-common role="submit" submit="确定" reset="重置"></dry-common>
    </form>
    <script>
        layui.use(["dry"], function(dry){
            function getVerify()
            {
                var result = {
                    dry_name:function(value){if(value == ""){return "请输入名称";}}
                };
                return result;
            }

            dry.submit(getVerify(), "/Admin/Model/index", "/Api/Model/new");
        });
    </script>
{% endblock %}